package com.race.service.impl;

import com.race.common.constant.ConstantInterface;
import com.race.common.returntype.R;
import com.race.entities.po.User;
import com.race.repository.UserRepository;
import com.race.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author xc
 */
@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserRepository userRepository;

    @Override
    public R<User> findAllUserInfoByUsername(String username) {
        User u = null;
        try {
            u = userRepository.findByUsername(username).get();
        } catch (Exception e) {
            e.printStackTrace();
            return R.error(ConstantInterface.ERROR);
        }
        return R.ok(ConstantInterface.SUCCESS,u);
    }

    @Override
    public R<User> findSimpleUserInfoById(int userId) {
        return null;
    }

    @Override
    public R<User> findSimpleUserInfoByUsername(String username) {
        return null;
    }
}
